import { Component, OnInit } from '@angular/core';
import {Router} from "@angular/router";

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {

  constructor(public  router : Router) { }
  menus:Array<Menu>;
  menu_id:number;
  ngOnInit() {
    this.menus=[
      new Menu(1,'首页','dubb'),
      new Menu(2,'管理','stock')
    ];

  }

  nav(url: Menu){
    this.router.navigateByUrl(url.link);
    this.menu_id=url.id;
  }
}
export  class Menu{
  constructor(
    public id: number,
    public name:string,
    public link:string
  ){

  }
}
